package com.neusoft;

import java.util.ArrayList;
import java.util.Collections;

public class Doudizhu {
/*
 * 54张：
 * 		1.定义一个花色数组
 * 		String[] huase = {♠  ♥  ♣ ♦};
 * 		2.	定义一个点数
 * 		String[] dianshu = {A~K};
 * 		3.定义集合：把组合好的 牌放入集合中
 * 		并且要添加大小王 ♚♕
 *		4.洗牌
 *			Collections.shuffle(集合名)
 *		5.定义一个方法(发牌)
 *				创建3个集合(代表3个玩家)
 *				提示：
 *						牌数 % 3 
 *		6.遍历每个玩家手里的牌  还有 三张底牌
 */
	public static void main(String[] args) {
		//1.准备54张牌
		ArrayList<String> pais = new ArrayList<>();
		pais.add("♚");
		pais.add("♕");
		String[] color = {"♠","♥","♣","♦"};
		String[] num = {"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
		for (String c : color) {
			for (String n : num) {
				pais.add(c+n);
			}
		}
		//2.洗牌
		Collections.shuffle(pais);
		
		//3.发牌
		ArrayList<String> p1 = new ArrayList<>();
		ArrayList<String> p2 = new ArrayList<>();
		ArrayList<String> p3 = new ArrayList<>();
		ArrayList<String> dp = new ArrayList<>();
		
		for(int i=0;i<pais.size();i++){
			if(i>=51){
				dp.add(pais.get(i));
			}else if(i%3==0){
				p1.add(pais.get(i));
			}else if(i%3==1){
				p2.add(pais.get(i));
			}else if(i%3==2){
				p3.add(pais.get(i));
			}
		}
		
		//遍历
		System.out.println("底牌："+dp);
		System.out.println("小王："+p1);
		System.out.println("小张："+p2);
		System.out.println("小鹿："+p3);
	}
}
